:root {
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1a1a1a;
    --muted: #6c757d;
    --primary: #0d6efd;
    --border: #e0e0e0;
}

/* OS-level preference (default, no manual override) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card: #1e293b;
        --text: #f1f5f9;
        --muted: #94a3b8;
        --primary: #3b82f6;
        --border: #334155;
    }
}

/* Manual overrides — these come AFTER the media query, so they win */
[data-theme="dark"] {
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --border: #334155;
}

/* ✅ This is what was missing */
[data-theme="light"] {
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1a1a1a;
    --muted: #6c757d;
    --primary: #0d6efd;
    --border: #e0e0e0;
}
body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}
*,*::before, *::after{
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    text-decoration: none;
}
a{
    color: inherit;
}
.main-title{
    margin: 20px 0;
}
.mb-20{
    margin-bottom: 20px;
}
/* Container */
.container {
    width: 90%;
    max-width: 1920px;
    margin: auto;
    padding: 20px 0;
}

/* News Card */
.news-card {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.news-card:hover {
    transform: translateY(-3px);
}

/* Title */
.news-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 15px;
}

.news-title a {
    text-decoration: none;
    color: var(--text);
}

.news-title a:hover {
    color: var(--primary);
}
i{
    font-size:20px;
}
/* Date */
.news-date {
    font-size: 13px;
    color: var(--muted);
    margin-top: 5px;
}

/* Detail Page */
.news-detail {
    background: var(--card);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Comment */
.comment {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.comment small {
    color: var(--muted);
}
.comment.reply {
    margin-left: 30px;
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    background: var(--bg);
}
/* Form */
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 10px;
    resize: none;
}

/* Button */
button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
}

button:hover {
    opacity: 0.9;
}

/* Share */
.share-box {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    align-items: center;
}

.share-box input {
    flex: 1;
    padding: 8px;
    margin-top: 10px;
    border-radius: 6px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.news-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}
.news-content {
    margin-top: 15px;
}
.news-grid.list-view .news-card .news-content{
    margin: 0;
    max-width: 50%;
}
div#comment-list {
    max-height: 400px;
    overflow-y: scroll;
    margin: 20px 0;
}


/* Toggle buttons */
.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.view-toggle button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    border-radius: 6px;
}
.view-toggle button i{
    color: var(--text)
}
/* Default GRID view */

/* LIST view */
.news-grid.list-view {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 0;
}

.news-grid.list-view .news-card {
    display: flex;
    flex-direction: row;
    gap: 20px;
    max-width: 800px;
    margin-bottom: 20px;
    width: 100%;
    justify-content:normal;
}

/* Image size in list */
.news-grid.list-view img,
.news-grid.list-view video {
    max-width: 50%;
    height: auto;
}

/* Card */
.news-card {
    background: var(--card);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.news-grid.list-view img
 {
    max-width: 350px !important;
    width: 100% !important;
    border-radius: 6px;
}


@media (max-width: 768px) {
.news-grid.list-view .news-card {
    flex-direction: column;
    align-items: center;
}
.news-grid.list-view{
    gap: 0;
}
.news-grid.list-view .news-card .news-content{
    max-width: 100%;
}
    .news-grid
 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.pagination a {
    background: var(--card);
    color: var(--text);
    transition: 0.2s;
}

.pagination a:hover {
    background: var(--primary);
    color: white;
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

@media (max-width: 480px) {
    .news-grid.list-view .news-card .excerpt, .news-grid.list-view .news-card .desc{
        display: none;
    }
    .news-grid.list-view .news-card{
        flex-direction: row;
        justify-content: normal;
        margin-bottom: 5px;
        gap: 8px;
    }
    .news-grid.list-view img{
        max-width: 50% !important;
    }
    .news-title{
        margin-bottom: 5px;
        font-size: 16px;
    }
    
}

